package com.yztc.yidoutang.activity.qwj_detail_activity;

import com.yztc.yidoutang.bean.QuanWuDetailBean;
import com.yztc.yidoutang.bean.QuanWuDetailListBean;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by My on 2016/10/24.
 */

public class QuanWuDetailPresenter implements QuanWuDetailContract.Presenter {
    private QuanWuDetailContract.Model model;
    private QuanWuDetailContract.View view;
    private Map<String,String> map;
    private QuanWuDetailListBean bean;

    public QuanWuDetailPresenter(QuanWuDetailContract.View view,QuanWuDetailListBean bean) {
        this.view = view;
        this.bean=bean;
        this.model=new QuanWuDetailModel();
    }

    @Override
    public void getDataForNet(String id) {

        map=new HashMap<>();
        //http://m.yidoutang.com/apiv3/case/detail?id=215971&reward_user=1
        map.put("id",id);
        map.put("reward_user","1");
        model.getQuanWuDetailData(map, new QuanWuDetailContract.OnLoadQuanWuDetailListener() {
            @Override
            public void onSuccess(QuanWuDetailBean detailBean) {
                bean=detailBean.getData().getCaseX();
                view.onQuanWuDetailSuccess(bean);
            }

            @Override
            public void onFail(Exception e) {

            }
        });
    }
}
